home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gnu / adainc / s-imgllu.adb < prev    next >
Text File  |  1996-01-30  |  3KB  |  81 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                         GNAT RUNTIME COMPONENTS                          --
  4. --                                                                          --
  5. --                       S Y S T E M . I M G _ L L U                        --
  6. --                                                                          --
  7. --                                 B o d y                                  --
  8. --                                                                          --
  9. --                            $Revision: 1.6 $                              --
  10. --                                                                          --
  11. --           Copyright (c) 1992,1993,1994 NYU, All Rights Reserved          --
  12. --                                                                          --
  13. -- The GNAT library is free software; you can redistribute it and/or modify --
  14. -- it under terms of the GNU Library General Public License as published by --
  15. -- the Free Software  Foundation; either version 2, or (at your option) any --
  16. -- later version.  The GNAT library is distributed in the hope that it will --
  17. -- be useful, but WITHOUT ANY WARRANTY;  without even  the implied warranty --
  18. -- of MERCHANTABILITY  or  FITNESS FOR  A PARTICULAR PURPOSE.  See the  GNU --
  19. -- Library  General  Public  License for  more  details.  You  should  have --
  20. -- received  a copy of the GNU  Library  General Public License  along with --
  21. -- the GNAT library;  see the file  COPYING.LIB.  If not, write to the Free --
  22. -- Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.        --
  23. --                                                                          --
  24. ------------------------------------------------------------------------------
  25.  
  26. with System.Unsigned_Types; use System.Unsigned_Types;
  27.  
  28. package body System.Img_LLU is
  29.  
  30.    ------------------------------
  31.    -- Image_Long_Long_Unsigned --
  32.    ------------------------------
  33.  
  34.    function Image_Long_Long_Unsigned
  35.      (V    : Long_Long_Unsigned;
  36.       S    : access String)
  37.       return Natural
  38.    is
  39.       P : Natural;
  40.  
  41.    begin
  42.       P := 1;
  43.       S (P) := ' ';
  44.       Set_Image_Long_Long_Unsigned (V, S.all, P);
  45.       return P;
  46.    end Image_Long_Long_Unsigned;
  47.  
  48.    -----------------------
  49.    -- Set_Image_Long_Long_Unsigned --
  50.    -----------------------
  51.  
  52.    procedure Set_Image_Long_Long_Unsigned
  53.      (V : Long_Long_Unsigned;
  54.       S : out String;
  55.       P : in out Natural)
  56.    is
  57.       procedure Set_Digits (T : Long_Long_Unsigned);
  58.       --  Set digits of absolute value of T
  59.  
  60.       procedure Set_Digits (T : Long_Long_Unsigned) is
  61.       begin
  62.          if T >= 10 then
  63.             Set_Digits (T / 10);
  64.             P := P + 1;
  65.             S (P) := Character'Val (48 + (T rem 10));
  66.  
  67.          else
  68.             P := P + 1;
  69.             S (P) := Character'Val (48 + T);
  70.          end if;
  71.       end Set_Digits;
  72.  
  73.    --  Start of processing for Set_Image_Long_Long_Unsigned
  74.  
  75.    begin
  76.       Set_Digits (V);
  77.  
  78.    end Set_Image_Long_Long_Unsigned;
  79.  
  80. end System.Img_LLU;
  81.